package com.fengli.servlet;

import com.alibaba.fastjson.JSONObject;
import com.fengli.service.UserService;
import com.fengli.service.impl.UserServiceImpl;
import com.fengli.vo.PageQueryResultVo;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;

public class UserServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        Integer page = Integer.parseInt(request.getParameter("page"));
        Integer pageSize = Integer.parseInt(request.getParameter("pageSize"));
        UserService userService = new UserServiceImpl();
        PageQueryResultVo resultVo = userService.pageQuery(page, pageSize);

        response.setContentType("application/json;charset=utf-8");
        response.getWriter().write(JSONObject.toJSONString(resultVo));
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("ff");
    }


}
